package com.nbgroup.web.Appraise;

import com.nbgroup.entity.Appraise;
import com.nbgroup.entity.Identity.Identity;
import com.nbgroup.service.Appraise.AppraiseService;
import com.nbgroup.utils.PageUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

@Controller
@RequestMapping("/appraiseTurn")
public class AppraiseTurnController {
    @Autowired
    private AppraiseService appraiseService;

    //zzp 查看评价列表
    @GetMapping("/getAllAppraises")
    public String getAllAppraises(Map<String, Object> map, Integer page, Integer pageSize) {
        PageUtil<Appraise> allAppraises = appraiseService.getAllAppraises(page, pageSize);
        for (int i = 0; i < allAppraises.getContent().size(); i++) {
            String star = "";
            for (int j = 0; j < allAppraises.getContent().get(i).getScore(); j++) {
                star += "⭐";
            }
            allAppraises.getContent().get(i).setStar(star);
        }
        map.put("datas", allAppraises);
        return "appraise/appraise";
    }
}
